
require(['jquery','swiper'],function($,aswiper){
	//图片滑动
	var aswiper = new Swiper('.swiper-container', {
        pagination:'.swiper-pagination',
        paginationClickable: true
    });
})

//设置html根目录字体大小
require(['jquery','../modules/pageSize'],function($,pageSetSize){
	setRootFontSize(pageSetSize);
})

//首页顶部滑动切换效果
require(['jquery','swiper'],function($,aswiper){
        $(document).bind('scroll',function(){
            if($(window).scrollTop()>100){
                $('.normal-shop-show,.shop-entry,.fixed-search').addClass('hide');
                $('.shop-search-bar').removeClass('hide');
            }
            else if($(window).scrollTop()<100){
                $('.shop-search-bar').addClass('hide');
                $('.normal-shop-show,.shop-entry,.fixed-search').removeClass('hide');
                
           }
           
    });

})

// 首页弹窗
require(['jquery','pincode','../modules/popup'],function($,pincode,popup){

    // 模拟假设条件
    var condition =2;
    if(condition == 1){
        //定位弹窗
        popup.popup('.locationChoice');
        $('.location-choice .confirm').click(function(){
            //do something;
        })
    }
    if(condition==2){
        popup.popup('.bindPhone');
        $('.location-choice .confirm').click(function(){
            //do something;
        })
    }
    //绑定手机输入框效果
    $('.bindPhone-box').find('.close').on('click',function(){
        $(this).parent().hide();
    })
    $('#phone').keyup(function(){
       $(this).siblings().css({
        'background':'#3c6a63',
        'color':'#fff'
       });
    })
    // 验证码输入框效果
    $('#code-input').pincodeInput({
        complete:function(value, e, errorElement){
            if(value=="1234"){
              $('.code-tips').hide();
              $('.inputInfo').hide();
              $('.success').show();
            }
            else{
                $('.code-tips').show();
                $('#code-input').pincodeInput().data('plugin_pincodeInput').clear();
                $('#code-input').pincodeInput().data('plugin_pincodeInput').focus();
            }
        }
    });
    
})
